<ui:composition template="/publico/template.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core">
    <ui:define name="content">
        <h:form id="fprincipal">
            <p:messages/>
            <p:panel id="pprincipal" 
                     header="Composição da Etapa">
                <h:panelGrid columns="1">
                    <h:inputHidden value="#{etapaBean.etapa.id}"/>

                    <p:outputLabel for="itEtapa" value="Etapa:"/>
                    <p:inputText 
                        id="itEtapa" 
                        value="#{etapaBean.etapa.nome}"
                        required="true"/>

                    <p:outputLabel value="Locais:"/>
                    <p:selectManyCheckbox 
                        label="Locais"
                        value="#{etapaBean.etapa.localizacoes}"
                        columns="2"
                        converter="LocalConversor">
                        <f:selectItems value="#{localBean.locais}"
                                       var="l"
                                       itemLabel="#{l.nome}"
                                       itemValue="#{l}"/>
                    </p:selectManyCheckbox>
                </h:panelGrid>

                <p>
                    <p:commandButton id="cbSalvar"
                                     ajax="false" 
                                     value="Salvar" 
                                     action="#{etapaBean.salvar}"/>

                    <p:button id="cbcancelar"
                              outcome="/admin/local/etapa/lista-etapa.xhtml"
                              value="Cancelar"/>
                </p>
            </p:panel> 
        </h:form>
    </ui:define>
</ui:composition>
